<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>XXX | Upload</title>
<link href="/resources/css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/resources/swfupload/swfupload.js"></script>
<script type="text/javascript" src="/resources/js/swfupload.queue.js"></script>
<script type="text/javascript" src="/resources/js/fileprogress.js"></script>
<script type="text/javascript" src="/resources/js/handlers.js"></script>
<script type="text/javascript" src="/resources/js/jquery-1.6.4.min.js"></script>
</head>
<body>
	<jsp:include page="jsp/header.jsp" />
	<div id="main">
		<p></p>
		<div class="fieldset flash" id="fsUploadProgress">
			<span class="legend">Upload Queue</span>
		</div>
		<div id="divStatus">0 Files Uploaded</div>
		<div>
			<span id="spanButtonPlaceHolder"></span><input id="btnCancel"
				type="button" value="Cancel All Uploads"
				onclick="swfu.cancelQueue();" disabled="disabled"
				style="margin-left: 2px; font-size: 8pt; height: 29px;" />
		</div>
		<div>
		<c:choose>
			<c:when test="${albumId != 0}">
				<a href="/i/v/${albumId}-30-1"><fmt:message key="upload.finishUpload"/></a>
			</c:when>
			<c:otherwise>
				<a href="/i/albums/"><fmt:message key="upload.finishUpload"/></a>
			</c:otherwise>
		</c:choose>
		</div>
	</div>
</body>

<script type="text/javascript">
	var initUpload = function() {
		var sessionId = "<%=session.getId()%>";
		var settings = {
			flash_url : "/resources/swfupload/swfupload.swf",
			upload_url : "/upload;jsessionid=" + $.trim(sessionId),
			file_post_name : "image",
			post_params : {
				"albumId" : "${albumId}"
			},
			file_size_limit : "10 MB",
			file_types : "*.jpg",
			file_types_description : "All Files",
			file_upload_limit : 10,
			file_queue_limit : 0,
			custom_settings : {
				progressTarget : "fsUploadProgress",
				cancelButtonId : "btnCancel"
			},
			debug : false,

			// Button settings
			button_image_url : "/resources/images/TestImageNoText_65x29.png",
			button_width : "65",
			button_height : "29",
			button_placeholder_id : "spanButtonPlaceHolder",
			button_text : '<span class="theFont">Hello</span>',
			button_text_style : ".theFont { font-size: 16; }",
			button_text_left_padding : 12,
			button_text_top_padding : 3,

			// The event handler functions are defined in handlers.js
			file_queued_handler : fileQueued,
			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,
			upload_start_handler : uploadStart,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadSuccess,
			upload_complete_handler : uploadComplete,
			queue_complete_handler : queueComplete
		// Queue plugin event
		};

		new SWFUpload(settings);
	};

	$(document).ready(function() {
		initUpload();
	});
</script>
</html>